<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Dell
  Date: 2019/1/22
  Time: 17:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>index</title>
    <meta http-equiv="X-UA-Compatible" content="edge" />
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all">
    <script src="js/jquery-1.8.3.min.js"></script>
    <script src="js/jquery.fly.min.js"></script>
    <script src="js/public.js"></script>
    <script src="js/base.js"></script>
    <script>document.createElement("top")</script>
    <script>document.createElement("search")</script>
    <script>document.createElement("light")</script>
    <script>document.createElement("light1")</script>
    <style type="text/css">
        .welcome{
            width: 120px;
            height: 30px;
            font-size: 12px;
            color: #666;
            line-height: 30px;
            position: relative;
            float: left;
        }
        #a1{
            color: white;
        }
        #a2{
            color: #C4CBCF;
            font-size: 14px;
        }
        #s1{
            color: #2D93CA;
            font-size: 15px;
            /*position: fixed;*/

        }
        #s1{

        }
    </style>
</head>


<body>


<!--头部-->
<top>
    <section class="seck">

        <div class="welcome"><em style="float:left">欢迎来到天猫商城</em></div>
        <div class="register_login">
            <c:choose>
                <c:when test="${ not  empty sessionScope.username }">
                    <em>您好，</em>
                    <a href="#">${sessionScope.username}</a>
                </c:when>
                <c:otherwise>
                    <a href="jsp/Jamin/Login.jsp">会员登录</a>
                    <a href="jsp/Jamin/Register.jsp">快速注册</a>
                </c:otherwise>
            </c:choose>

        </div>
        <div class="vip_center">
            <div class="dis_add">
                <a href="#">会员中心<img src="images/jt_t.png" style="display:block;width:7px;height:4px; float:left; margin-top:14px; margin-left:3px">

                    <div class="hide_add">
                        <ul>
                            <li><a href="#">我的资料</a></li>
                            <li><a href="#">我的订单</a></li>
                            <li><a href="#">我的购物车</a></li>
                            <li><a href="#">我的收藏</a></li>
                        </ul>

                    </div>

                </a>
            </div>
            <a href="#">我的订单</a>
            <a href="#">收藏夹</a>
            <a href="#">联系客服</a>
            <c:if test="${ not  empty sessionScope.username }" var="result" scope="session">
                <a href="/ExitServlet">退出</a>
            </c:if>
        </div>
    </section>
</top>
<!--header-->
<div class="maxbj1">
    <header>
        <b class="logo"><img src="images/logo.png"></b>
        <search>

                <input id="inpu1" value="" type="text" placeholder="请输入商品名" required style=" width:440px; height:30px; text-indent:2em; float:left; box-shadow:none">
                <button id="butto1">搜索</button>

        </search>
        <div class="sping_car">
            <b></b>
            <em>我的购物车</em>
        </div>
    </header>
</div>
<!--导航-->
<section class="dao_hang">
    <nav>
        <!--全部商品分类-->
        <div class="important"><img src="images/all_list.png" style=" margin-top:8px">&nbsp;全部商品分类
            <aside>
                <ul>
                    <c:forEach var="l" items="${requestScope.commodityClasses}">
                        <c:if test="${l.faId==100}" var="result" scope="session">
                    <li class="cates"  mt-ct="${l.clId}">

                        <p>

                            <a id="a1" href="FindServlet?A=${l.clName}"><span class="layui-icon">&#xe64c;</span>&nbsp;&nbsp;&nbsp;${l.clName}</a>
                            <i style="font-family:'宋体'; line-height:26px; font-size:22px; float:right">></i>
                        </p>
                    </li>
                        </c:if>
                    </c:forEach>
                </ul>
            </aside>
            <div>
                <c:forEach var="k" items="${requestScope.commodityClasses}">
                    <c:if test="${k.faId==100}" var="result" scope="session">
                <div class="import_list b-${k.clId}">


                    <dd>
                        <c:forEach var="m" items="${requestScope.commodityClasses}">
                        <c:if test="${m.faId==k.clId}" var="result" scope="session">
                        <a href="FindServlet?A=${m.clName}">${m.clName}</a>
                        </c:if>
                        </c:forEach>
                    </dd>

                </div>
                    </c:if>
                </c:forEach>
            </div>
        </div>
        <!--结束-->
        <div class="dao_list">
            <a href="#">首页</a>
            <a href="#">天猫商城</a>
            <a href="#">天猫超市</a>
            <a href="#">新品手机</a>
            <a href="#">生活必备</a>
            <a href="#">海澜之家</a>
            <a href="#">美容美颜</a>
        </div>

    </nav>
</section>
<!--banner-->
<div id="banner_tabs" class="flexslider">
    <ul class="slides">
        <li>
            <a title="" target="_blank" href="#">
                <img width="1920" height="500" alt="" style="background: url(images/lbt01.png) no-repeat center;" src="images/lbt01.png">
            </a>
        </li>
        <li>
            <a title="" href="#">
                <img width="1920" height="500" alt="" style="background: url(images/lbt02.png) no-repeat center;" src="images/lbt02.png">
            </a>
        </li>
        <li>
            <a title="" href="#">
                <img width="1920" height="500" alt="" style="background: url(images/lbt03.png) no-repeat center;" src="images/lbt03.png">
            </a>
        </li>
        <li>
            <a title="" href="#">
                <img width="1920" height="500" alt="" style="background: url(images/lbt04.png) no-repeat center;" src="images/lbt04.png">
            </a>
        </li>
    </ul>
    <ul class="flex-direction-nav">
        <li><a class="flex-prev" href="javascript:;">Previous</a></li>
        <li><a class="flex-next" href="javascript:;">Next</a></li>
    </ul>
    <ol id="bannerCtrl" class="flex-control-nav flex-control-paging">
        <li class="active"><a>1</a></li>
        <li><a>2</a></li>
        <li><a>2</a></li>
        <li><a>2</a></li>
    </ol>
</div>
<script src="js/slider.js"></script>
<!--gong告-->
<script type="text/javascript">
        $(".advertisement").animate({'top':'30','opacity':'1'},200)
        window.onload=function(){
        $(".flexslider").animate({'margin-top':'0'},200)
        $("aside").animate({'top':'30','opacity':'0.85'},200)
    }
</script>
<!--楼层分布图-->

<div class="fixed_position">
    <div class="fixed_position_1">
        <ul>
            <li>导航</li>
            <li>秒杀活动</li>
            <li>海澜之家</li>
            <li>生活必备</li>
            <li>新品手机</li>
            <li>美容美颜</li>
        </ul>
    </div>
</div>
<!--福包专区-->
<span class="as blessing_package">
	<h3>秒杀活动<font>每日19:00-20:00，好礼优惠不停</font></h3>
</span>


<!--猜你喜欢-->
<div class="as kongzhianniu">
    <div class="lunbobanner">
        <ul class="lunboimg">
            <li>
                <c:forEach var="l" items="${requestScope.seckillCommodities}" begin="0" end="4">
                    <a href="JavaScript:;" onclick="detail(${l.goId})">
                        <b><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></b>
                        <span>￥${l.goPrice}</span>
                        <p>${l.goName}</p>
                    </a>
                </c:forEach>
            </li>
            <li>
                <c:forEach var="l" items="${requestScope.seckillCommodities}" begin="5" end="9">
                    <a href="JavaScript:;" onclick="detail(${l.goId})">
                        <b><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></b>
                        <span>￥${l.goPrice}</span>
                        <p>${l.goName}</p>
                    </a>
                </c:forEach>

            </li>
        </ul>
    </div>
    <div class="btnl"><</div>
    <div class="btnr">></div>
    <h4 class="guanfangremai">计时器</h4>
</div>
<!--海澜之家-->
<span class="as blessing_package">
	<a href="#" style=" color:#000"><h3 style="float:left">&nbsp;海澜之家<img src="images/zd.png" style="display:block; float:left; margin-top:5px"></h3></a>
    <div class="detailed_navigation">
    	<ul>
        	<li class="dog d-1-lt01 yadi"  dg-floor="1"  dg-ct="lt01">外套</li>
            <li class="dog d-1-lt02"  dg-floor="1"  dg-ct="lt02">毛针织衫</li>
        </ul>
    </div>
</span>
<div>
    <div class="currency f-1-lt01">
        <ul>
            <c:forEach var="l" items="${requestScope.commoditiesBy110}" begin="0" end="4">
            <li>

                <a href="JavaScript:;" onclick="detail(${l.goId})"><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></a>
                <light1>
                    <img src="images/saoguang.png">
                </light1>
                <span>￥${l.goPrice}<a id="a2">/￥${l.goCost}</a></span>
                <a href="JavaScript:;" onclick="detail(${l.goId})"><p style="height: 58px">${l.goName}</p></a>
                <span id="s1">销量<a id="a2">&nbsp;${l.goSalesvolume}</a></span>
                <em>
                    <a href="JavaScript:;" onclick="collection(${l.goId})">收藏</a>
                    <a href="javascript:void(0)" class="add_scar" onclick="addgoods(${l.goId})">加入购物车</a>
                </em>

            </li>
            </c:forEach>
        </ul>
    </div>
    <div class="currency f-1-lt02" style="display:none">
        <ul>
            <c:forEach var="l" items="${requestScope.commoditiesBy122}" begin="0" end="4">
                <li>

                    <a href="JavaScript:;" onclick="detail(${l.goId})"><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></a>
                    <light1>
                        <img src="images/saoguang.png">
                    </light1>
                    <span>￥${l.goPrice}<a id="a2">/￥${l.goCost}</a></span>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><p style="height: 58px">${l.goName}</p></a>
                    <span id="s1">销量<a id="a2">&nbsp;${l.goSalesvolume}</a></span>
                    <em>
                        <a href="JavaScript:;" onclick="collection(${l.goId})">收藏</a>
                        <a href="javascript:void(0)" class="add_scar" onclick="addgoods(${l.goId})">加入购物车</a>
                    </em>

                </li>

            </c:forEach>

        </ul>
    </div>

</div>


<!--生活必备-->
<span class="as blessing_package">
	<a href="#" style=" color:#000"><h3 style="float:left">&nbsp;生活必备<img src="images/zd.png" style="display:block; float:left; margin-top:5px"></h3></a>
    <div class="detailed_navigation">
    	<ul>
        	<li class="dog d-2-lt01 yadi"  dg-floor="2"  dg-ct="lt01">钱包</li>
            <li class="dog d-2-lt02"  dg-floor="2"  dg-ct="lt02">流行女鞋</li>
        </ul>
    </div>
</span>
<div>
    <div class="currency f-2-lt01">
        <ul>
            <c:forEach var="l" items="${requestScope.commoditiesBy150}" begin="0" end="4">
            <li>
                <a href="JavaScript:;" onclick="detail(${l.goId})"><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></a>
                <light1>
                    <img src="images/saoguang.png">
                </light1>
                <span>￥${l.goPrice}<a id="a2">/￥${l.goCost}</a></span>
                <a href="JavaScript:;" onclick="detail(${l.goId})"><p style="height: 58px">${l.goName}</p></a>
                <span id="s1">销量<a id="a2">&nbsp;${l.goSalesvolume}</a></span>
                <em>
                    <a href="JavaScript:;" onclick="collection(${l.goId})">收藏</a>
                    <a href="javascript:void(0)" class="add_scar" onclick="addgoods(${l.goId})">加入购物车</a>
                </em>
            </li>
            </c:forEach>
        </ul>
    </div>
    <div class="currency f-2-lt02" style="display:none">
        <ul>
            <c:forEach var="l" items="${requestScope.commoditiesBy130}" begin="0" end="4">
                <li>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></a>
                    <light1>
                        <img src="images/saoguang.png">
                    </light1>
                    <span>￥${l.goPrice}<a id="a2">/￥${l.goCost}</a></span>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><p style="height: 58px">${l.goName}</p></a>
                    <span id="s1">销量<a id="a2">&nbsp;${l.goSalesvolume}</a></span>
                    <em>
                        <a href="JavaScript:;" onclick="collection(${l.goId})">收藏</a>
                        <a href="javascript:void(0)" class="add_scar" onclick="addgoods(${l.goId})">加入购物车</a>
                    </em>
                </li>
            </c:forEach>
        </ul>
    </div>

</div>
<!--新品手机-->
<span class="as blessing_package">
	<a href="#" style=" color:#000"><h3 style="float:left">&nbsp;新品手机<img src="images/zd.png" style="display:block; float:left; margin-top:5px"></h3></a>
    <div class="detailed_navigation">
    	<ul>
        	<li class="dog d-3-lt01 yadi"  dg-floor="3"  dg-ct="lt01">华为</li>
            <li class="dog d-3-lt02"  dg-floor="3"  dg-ct="lt02">apple</li>
        </ul>
    </div>
</span>
<div>
    <div class="currency f-3-lt01">
        <ul>
            <c:forEach var="l" items="${requestScope.commoditiesBy140}" begin="0" end="4">
                <li>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></a>
                    <light1>
                        <img src="images/saoguang.png">
                    </light1>
                    <span>￥${l.goPrice}<a id="a2">/￥${l.goCost}</a></span>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><p style="height: 58px">${l.goName}</p></a>
                    <span id="s1">销量<a id="a2">&nbsp;${l.goSalesvolume}</a></span>
                    <em>
                        <a href="JavaScript:;" onclick="collection(${l.goId})">收藏</a>
                        <a href="javascript:void(0)" class="add_scar" onclick="addgoods(${l.goId})">加入购物车</a>
                    </em>
                </li>
            </c:forEach>

        </ul>
    </div>
    <div class="currency f-3-lt02" style="display:none">
        <ul>
            <c:forEach var="l" items="${requestScope.commoditiesBy144}" begin="0" end="4">
                <li>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></a>
                    <light1>
                        <img src="images/saoguang.png">
                    </light1>
                    <span>￥${l.goPrice}<a id="a2">/￥${l.goCost}</a></span>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><p style="height: 58px">${l.goName}</p></a>
                    <span id="s1">销量<a id="a2">&nbsp;${l.goSalesvolume}</a></span>
                    <em>
                        <a href="JavaScript:;" onclick="collection(${l.goId})">收藏</a>
                        <a href="javascript:void(0)" class="add_scar" onclick="addgoods(${l.goId})">加入购物车</a>
                    </em>
                </li>
            </c:forEach>
        </ul>
    </div>

</div>
<!--美颜美容-->
<span class="as blessing_package">
	<a href="#" style=" color:#000"><h3 style="float:left">&nbsp;美颜美容<img src="images/zd.png" style="display:block; float:left; margin-top:5px"></h3></a>
    <div class="detailed_navigation">
    	<ul>
        	<li class="dog d-4-lt01 yadi"  dg-floor="4"  dg-ct="lt01">面膜</li>
            <li class="dog d-4-lt02"  dg-floor="4"  dg-ct="lt02">香水</li>
        </ul>
    </div>
</span>
<div>
    <div class="currency f-4-lt01">
        <ul>
            <c:forEach var="l" items="${requestScope.commoditiesBy160}" begin="0" end="4">
                <li>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></a>
                    <light1>
                        <img src="images/saoguang.png">
                    </light1>
                    <span>￥${l.goPrice}<a id="a2">/￥${l.goCost}</a></span>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><p style="height: 58px">${l.goName}</p></a>
                    <span id="s1">销量<a id="a2">&nbsp;${l.goSalesvolume}</a></span>
                    <em>
                        <a href="JavaScript:;" onclick="collection(${l.goId})">收藏</a>
                        <a href="javascript:void(0)" class="add_scar" onclick="addgoods(${l.goId})">加入购物车</a>
                    </em>
                </li>
            </c:forEach>
        </ul>
    </div>
    <div class="currency f-4-lt02" style="display:none">
        <ul>
            <c:forEach var="l" items="${requestScope.commoditiesBy165}" begin="0" end="4">
                <li>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><img src="images/${l.goPictureUrl}" style=" margin:0 auto; display:block; width:220px; height:220px"></a>
                    <light1>
                        <img src="images/saoguang.png">
                    </light1>
                    <span>￥${l.goPrice}<a id="a2">/￥${l.goCost}</a></span>
                    <a href="JavaScript:;" onclick="detail(${l.goId})"><p style="height: 58px">${l.goName}</p></a>
                    <span id="s1">销量<a id="a2">&nbsp;${l.goSalesvolume}</a></span>
                    <em>
                        <a  href="JavaScript:;" onclick="collection(${l.goId})">收藏</a>
                        <a href="javascript:void(0)" class="add_scar" onclick="addgoods(${l.goId})">加入购物车</a>
                    </em>
                </li>
            </c:forEach>

        </ul>
    </div>

</div>



<!--页脚-->
<footer>
    <section class="foot_in">
        <!--left-->
        <div class="foot_in_left">
            <div>
                <h5>新手入门</h5>
                <ul>
                    <li><a href="#">新手入门</a></li>
                    <li><a href="#">新手入门</a></li>
                    <li><a href="#">新手入门</a></li>
                    <li><a href="#">新手入门</a></li>
                </ul>
            </div>
            <div>
                <h5>订单服务</h5>
                <ul>
                    <li><a href="#">订单服务</a></li>
                    <li><a href="#">订单服务</a></li>
                    <li><a href="#">订单服务</a></li>
                    <li><a href="#">订单服务</a></li>
                </ul>
            </div>
            <div>
                <h5>配送服务</h5>
                <ul>
                    <li><a href="#">配送服务</a></li>
                    <li><a href="#">配送服务</a></li>
                    <li><a href="#">配送服务</a></li>
                </ul>
            </div>
            <div>
                <h5>售后服务</h5>
                <ul>
                    <li><a href="#">售后服务</a></li>
                    <li><a href="#">售后服务</a></li>
                    <li><a href="#">售后服务</a></li>
                </ul>
            </div>
            <div>
                <h5>会员中心</h5>
                <ul>
                    <li><a href="#">会员中心</a></li>
                    <li><a href="#">会员中心</a></li>
                    <li><a href="#">会员中心</a></li>
                    <li><a href="#">会员中心</a></li>
                </ul>
            </div>
            <div>
                <h5>下载APP</h5>
                <img src="images/ewm.jpg" width="153" height="153" style="display:block">
            </div>
        </div>
        <!--right-->
        <div class="foot_in_right">
            <div>
                <h5>联系我们</h5>
                <p><img src="images/dian.png" width="40" height="40" style=" float:left"><em style=" float:left; line-height:40px; color:#eb4e01; font-size:20px">&nbsp;&nbsp;&nbsp;6001-666-888</em></p>
                <p><img src="images/wx.png" width="40" height="40" style=" float:left"><em style=" float:left; line-height:40px; color:#eb4e01; font-size:20px">&nbsp;&nbsp;&nbsp;<a href="#" style="color:#eb4e01">在线客服</a></em></p>
            </div>
        </div>
    </section>
</footer>
<div class="foots">
    <div class="foots_in">
        <a href="#" style=" float:left">
            <img src="images/logo1.png" width="124" height="56" style="display:block; margin-top:2px">
        </a>
        <em>CopyRight © 2000-2016 BitAuto,All Rights Reserved.</em>
    </div>
</div>
<!--侧边栏-->
<div class="toolbar">
    <a href="###" class="toolbar-item toolbar-item-weixin" style=" position:relative">
        <em style=" position:absolute; display:block; line-height:20px; font-size:12px; color:#f00; top:-20px; left:0">(0)</em>
        <!--<span class="toolbar-layer"></span>-->
    </a>
    <a href="###" class="toolbar-item toolbar-item-feedback"></a>
    <a href="###" class="toolbar-item toolbar-item-app">
        <span class="toolbar-layer"></span>
    </a>
    <a href="javascript:scroll(0,0)" id="top" class="toolbar-item toolbar-item-top"></a>
</div>
<!--购物车fly插件-->
</body>
<script>

    //加入购物车
    function addgoods(id) {
        var session="${sessionScope.username}"
        var s=""
        if(session==null || session==s){
            location.href="BgLogin.jsp";
        }else {
            $.ajax({
                url:"/AddCommServlet",   //请求路径
                datatype:"json",//返回的格式
                data:{id:id,name:session}, //参数
                type:"get", //什么请求
                success:function (data) { //请求成功以后
                    //AJAX成功以后返回的
                    var obj = eval('(' + data + ')');
                    alert(obj.msg);

                    //延时500ms关闭窗口
                    setTimeout(function () {
                        location.reload();
                    }, 500);
                }
            });
        }
    }

    //收藏
    function collection(id) {
        var session="${sessionScope.username}"
        var s=""
        if(session==null || session==s){
            location.href="BgLogin.jsp";
        }else {
            $.ajax({
                url:"/CollectionServlet",   //请求路径
                datatype:"json",//返回的格式
                data:{id:id,name:session}, //参数
                type:"get", //什么请求
                success:function (data) { //请求成功以后
                    //AJAX成功以后返回的
                    var obj = eval('(' + data + ')');
                    alert(obj.msg);

                    //延时500ms关闭窗口
                    setTimeout(function () {
                        location.reload();
                    }, 500);
                }
            });
        }
    }

    //进入商品详情
    function detail(id) {
        location.href="DetaiServlet?id="+id;
    }
    $(function () {
        $("#butto1").click(function () {
            var a=$("#inpu1").val();
            if(a!=null && a!=""){
                window.location.href="/FindServlet?A="+a;
            }else {
                alert("请输入商品关键字")
            }
        })
})


</script>
</html>
